<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
   <%@ include file="/WEB-INF/views/common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
		<title>Insert title here</title>
		<style type="text/css">
			tr{
				width:40px;
			}
		</style>
  <script type="text/javascript">
	var datagrid;
	var rowEditor=undefined;
	$(function(){
		datagrid=$("#dg").datagrid({
			url:"${cs}/cs/credit/capital/mylist",//加载的URL
		    isField:"id",
			pagination:true,//显示分页
			pageSize:10,//分页大小
			pageList:[10,15,20],//每页的个数
			fit:true,//自动补全
			fitColumns:true,
			iconCls:"icon-save",//图标
			
			columns:[[      //每个列具体内容
		              {field:'id', hidden:true },   
		              {field:'inflowName', title:'转入账户',  width:"10%", align:'center' },
		              {field:'outerName',title:'转出账户',width:"10%", align:'center'},
		              {field:'money',title:'层级',width:"15%", align:'center',
		            	  formatter: function(val,row, index) {
			            		return "￥"+val;
			            	}   
		              },   
		              {field:'reason',title:'转账说明',width:"25%", align:'center'},
		              {field:'time',title:'交易时间',width:"20%", align:'center',
		             	 formatter:function(value,rowData,rowIndex) { 
		            		  var date = new Date(value);//long转换成date
		                      var month = (date.getMonth() + 1);
		                      var day = date.getDate().toString();
		                      if (month < 10) {
		                          month = "0" + month;
		                      }
		                      if (day < 10) {
		                          day = "0" + day;
		                      }
		                      return date.getFullYear().toString() + "年" + month + "月" + day+"日"+date.getHours()+"时"+date.getMinutes()+"分"+date.getSeconds()+"秒";
		             	 }
		              },
		              {field:'opt',title:'状态',width:"11%", align:'center',
		            	  formatter: function(val,row, index) {
			            		if (val == 1){
			        				return '<span style="color:#2575ed;">转入('+val+')</span>';
			        			} else if (val == 0) {
			        				return '<span style="color:red;">转出('+val+')</span>';;
			        			}
			            	}   
		              },
		              {field:'type',title:'类型',width:"10%", align:'center',
		            	  formatter: function(val,row, index) {
		            		  switch(val){
		            		 	case 1:return '<span style="color:#BFCC22">借贷（'+val+'）</span>';
		            			case 2:return '<span style="color:#FFCC22">充值（'+val+'）</span>';
		            			case 3:return '<span style="color:#33FF33">利息（'+val+'）</span>';
		            			case 4:return '<span style="color:#0000FF">提现（'+val+'）</span>';
		            			case 5:return '<span style="color:#4B0082">转账（'+val+'）</span>';
		            			default: return;
			            		}
			            	}   
		              }
		          ]],
		});
		$("#btn_search").click(function(){
			var param = $("#searchForm").serializeJson();
			console.log(datagrid);
			datagrid.datagrid('load',param);
			});
		$('#types').combobox({
			 data: [{"menuName": '全部', "id": '-1'},
			        {"menuName": '借贷', "id": '1'},
			        {"menuName": '充值', "id": '2'},
			        {"menuName": '利息', "id": '3'},
			        {"menuName": '提现', "id": '4'},
			        {"menuName": '转账', "id": '5'}
			        ],
			 valueField:'id',
			 textField:'menuName',
			 value:'-1'
		 });
		$('#opt').combobox({
			 data: [{"menuName": '全部', "id": '-1'},
			        {"menuName": '转入', "id": '0'},
			        {"menuName": '转出', "id": '1'},
			        ],
			 valueField:'id',
			 textField:'menuName',
			 value:'-1'
		 });
		});
    </script>
</head>
<body style="padding:0 4px; margin:0;  overflow: hidden; ">
<div class="easyui-layout" style="width:100%;height:100%;" data-options="fit:true">
		<div title="权限管理" data-options="region:'north'" style="height:70px">
		 <form id="searchForm" >
			<table cellpadding="5">
				    		<tr>
				    			<td>原因搜索:</td>
				    			<td><input class="easyui-textbox" type="text"  name="reason" ></input></td>
				    			<td>借贷类型:</td>
				    			<td><input class="easyui-combobox" type="text" id="types"  name="type" data-options="panelHeight:'auto'"></input></td>
				    			<td>方式:</td>
				    			<td><input class="easyui-combobox" type="text" id="opt"  name="opt" data-options="panelHeight:'auto'"></input></td>
				    			<td ><a href="#" id="btn_search" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:80px">Search</a></td>
				    		</tr>
				    		<tr>
				    		</tr>
				    	</table>
				  </form>
		</div>
		<div data-options="region:'center'" >
			<table id="dg" >
			</table>
		</div>
		</div>
</body>
</html>